package com.zhijian.warehouse.manage.controller;

import com.zhijian.response.annotation.Response;
import com.zhijian.util.page.Page;
import com.zhijian.warehouse.manage.entity.vo.request.StoreOptRecordSaveOrUpdateVo;
import com.zhijian.warehouse.manage.entity.vo.request.StoreOptRecordSearchVo;
import com.zhijian.warehouse.manage.entity.vo.response.StoreOptRecordVo;
import com.zhijian.warehouse.manage.service.StoreOptRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 影响库存操作记录表 控制层
 *
 * @author auto
 * @version 1.0
 * @date 2024-10-28 10:28:44
 */
@Slf4j
@Controller
@Api(tags = "产品出入查询")
public class StoreOptRecordController {

    @Autowired
    private StoreOptRecordService service;





    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    @Response
    @GetMapping("/store/opt/record/{id}")
    @ApiOperation("根据id查询")
    public StoreOptRecordVo selectById(@PathVariable("id") Long id) {
        log.info("{} - {}| query info", this.getClass().getSimpleName(), id);
        return service.selectVoById(id);
    }

    /**
     * 分页查询
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/store/opt/record/page")
    @ApiOperation("分页查询")
    public Page<StoreOptRecordVo> selectByCondition(@RequestBody(required = false) StoreOptRecordSearchVo param) {
        if (param == null)
            param = StoreOptRecordSearchVo.builder().build();
        log.info("{} - {}| query info", this.getClass().getSimpleName(), param);
        return service.selectPage(param);
    }

    /**
     * 列表查询
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/store/opt/record/list")
    @ApiOperation("列表查询")
    public List<StoreOptRecordVo> selectList(@RequestBody(required = false) StoreOptRecordSearchVo param) {
        if (param == null)
            param = StoreOptRecordSearchVo.builder().build();
        log.info("{} - {}| query info", this.getClass().getSimpleName(), param);
        return service.selectList(param);
    }



}
